﻿using System;
using System.Reflection;

namespace Utils
{
	[Serializable]
	public class PropertyChangedNotifierCopyable<T> : PropertyChangedNotifier, ICopyable<T>
	{
		#region ICopyable

		public void Copy(T source)
		{
			PropertyInfo[] properties = this.GetType().GetProperties();

			foreach (PropertyInfo property in properties)
			{
				property.SetValue(this, property.GetValue(source, new object[] { }), new object[] { });
			}
		}

		#endregion
	}
}
